var ULTI = {
		nl2br: function  (str) {   
			var breakTag = '<br/>';  
			return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
		},
		ranString: function(length){
			var strRan = 'qwertyuiopasdfghjkzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789~!@#$%^&*()_-+=:;<,>.?';
			var strReturn = '';
			var ranNum = 0;
			length = parseInt(length, 10) <=0? 6:parseInt(length, 10);
			for(var i=0; i<length; i++){
				ranNum = Math.floor(Math.random() * strRan.length);
				strReturn +=strRan[ranNum];
			}
			return strReturn;
		},
		printSWF: function(options){
			options=$.extend({
				  width: '100',
				  height: '100',
				  path: '',
				  flashvars: '',
				  wmode: 'transparent',
				  divclass: 'not-click'
			  },options);
			var str = 	'<div class="'+options.divclass+'" style="width:'+options.width+'px; height:'+options.height+'px;">'
							+'<object type="application/x-shockwave-flash" data="'+options.path+'" width="'+options.width+'" height="'+options.height+'">'
								+'<param name="movie" value="'+options.path+'" />'
								+'<param name="AllowScriptAccess" value="always">'
								+'<param name="quality" value="high" />'
								+'<param name="wmode" value="'+options.wmode+'" />'
								+'<param name="swfversion" value="8.0.35.0" />'
								+'<param name="FlashVars" value="'+options.flashvars+'">'
								+'<param name="expressinstall" value="/js/ulti/flash-scripts/expressInstall.swf" />'
								+'<embed src="'+options.path+'" flashvars="'+options.flashvars+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" play="true" loop="true" wmode="'+options.wmode+'" allowscriptaccess="always" width="'+options.width+'" height="'+options.height+'">'
							+'</object>'
						+'</div>';
			return str;
		},
		escapeHTML: function(str){
			var entityMap = {
					"&": "&#38;",
					"<": "&#60;",
					">": "&#62;",
					'"': '&#34;',
					"'": '&#39;',
					"/": '&#47;',
					"\\": '&#92;',
					"[": '&#91;',
					"]": '&#93;',
					'{': '&#123;',
					'}': '&#125;'
					
			};
			return String(str).replace(/[&<>"'\/\\[]{}]/g, function (s) {
				return entityMap[s];
			});
		},
		encodeHTML: function(str){
			return $('<div/>').text(str).html();
		},
		decodeHTML: function(html){
			return $('<div/>').html(html).text();
		}
}
